import http from '@/utils/http'

const BASE_URL = '/card/companyIntroduction'

export interface CompanyIntroductionResp {
  id: string
  companyId: string
  title: string
  content: string
  description: string
  createTime: string
  createUser: string
  updateTime: string
  updateUser: string
  createUserString: string
  updateUserString: string
}
export interface CompanyIntroductionDetailResp {
  id: string
  companyId: string
  title: string
  content: string
  description: string
  createTime: string
  createUser: string
  updateTime: string
  updateUser: string
  createUserString: string
  updateUserString: string
}
export interface CompanyIntroductionQuery {
  companyId: string
  sort: Array<string>
}
export interface CompanyIntroductionPageQuery extends CompanyIntroductionQuery, PageQuery {}

/** @desc 查询公司简介列表 */
export function listCompanyIntroduction(query: CompanyIntroductionPageQuery) {
  return http.get<PageRes<CompanyIntroductionResp[]>>(`${BASE_URL}`, query)
}

/** @desc 查询公司简介详情 */
export function getCompanyIntroduction(id: string) {
  return http.get<CompanyIntroductionDetailResp>(`${BASE_URL}/${id}`)
}

/** @desc 新增公司简介 */
export function addCompanyIntroduction(data: any) {
  return http.post(`${BASE_URL}`, data)
}

/** @desc 修改公司简介 */
export function updateCompanyIntroduction(data: any, id: string) {
  return http.put(`${BASE_URL}/${id}`, data)
}

/** @desc 删除公司简介 */
export function deleteCompanyIntroduction(id: string) {
  return http.del(`${BASE_URL}/${id}`)
}

/** @desc 导出公司简介 */
export function exportCompanyIntroduction(query: CompanyIntroductionQuery) {
  return http.download<any>(`${BASE_URL}/export`, query)
}
